#ifndef NARYTREE_H
#define NARYTREE_H

#include "globals.h"



typedef struct tree_node
{
fd *data;

int is_deleted;
struct tree_node *left_child;
struct tree_node *right_siblings;
struct tree_node *parent;
}t_node;

int validate_path(t_node **root,char *path);
int insert_node(t_node** root, fd* data); 
/* Inserts a node into the tree. It gets the relevant information from the file descriptor passed to it. If the path is invalid, appropriate error message is returned*/
int delete_node(t_node** root,char* fullpath);
/* Removes a node from the tree. The infrmation about the node to be removed could be determined using the path and the name. */
t_node* returnnode(t_node* root, char* fullpath);
/* Given the path, it returns the node from the tree*/
int move_node(t_node* root,char* source_path,char* destination_path);
/* It moves the given node corresponding to source path to the destination path*/
fd* get_node(t_node** root,char* fullpath);

int get_children(t_node** root,char* fullpath,fd **data[]);


int printtree(t_node* root); /* Prints the tree.*/
void Recursive_Print(t_node * node, FILE *fp);
void Nonrecursive_Print(t_node * node, FILE *fp);
void remove_a_node(t_node* node, t_node** root);


#endif

